import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'Login',
    component: () => import(/* webpackChunkName: "about" */ '../views/Login.vue')
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import(/* webpackChunkName: "about" */ '../views/Register.vue')
  },
  {
    path: '/',
    name: 'Manager',
    redirect: '/home',//重定向
    component: () => import(/* webpackChunkName: "about" */ '../views/Manager.vue'),

    children: [
      {path: '/home', name: 'Home', component: () => import('../views/manager/Home.vue')},
      {path: '/image information1', name: 'ImageInformation', component: () => import('../views/manager/ImageInformation.vue')},
      {path: '/announcement1', name: 'Announcement', component: () => import('../views/manager/Announcement.vue')},
      {path: '/department1', name: 'Department', component: () => import('../views/manager/Department.vue')},
      {path: '/pay1', name: 'Pay', component: () => import('../views/manager/Pay.vue')},
      {path: '/finance information1', name: 'FinanceInformation', component: () => import('../views/manager/FinanceInformation.vue')},
      {path: '/leave approval1', name: 'LeaveApproval', component: () => import('../views/manager/LeaveApproval.vue')},
      {path: '/asset information1', name: 'AssetInformation', component: () => import('../views/manager/AssetInformation.vue')},
      {path: '/asset approval1', name: 'AssetApproval', component: () => import('../views/manager/AssetApproval.vue')},
      {path: '/user information1', name: 'UserInformation', component: () => import('../views/manager/UserInformation.vue')},
      {path: '/finance information3', name: 'FinanceInformation', component: () => import('../views/employee/FinanceInformation.vue')},
      {path: '/leave record3', name: 'LeaveRecord', component: () => import('../views/employee/LeaveRecord.vue')},
      {path: '/asset information3', name: 'AssetInformation', component: () => import('../views/employee/AssetInformation.vue')},
      {path: '/employee asset3', name: 'EmployeeAsset', component: () => import('../views/employee/EmployeeAsset.vue')},
      {path: '/asset approval2', name: 'AssetApproval', component: () => import('../views/director/AssetApproval.vue')},
      {path: '/asset information2', name: 'AssetInformation', component: () => import('../views/director/AssetInformation.vue')},
      {path: '/employee asset2', name: 'EmployeeAsset', component: () => import('../views/director/EmployeeAsset.vue')},
      {path: '/finance information2', name: 'FinanceInformation', component: () => import('../views/director/FinanceInformation.vue')},
      {path: '/leave record2', name: 'LeaveRecord', component: () => import('../views/director/LeaveRecord.vue')},
      {path: '/leave approval2', name: 'LeaveApproval', component: () => import('../views/director/LeaveApproval.vue')},
      {path: '/personal information', name: 'PersonalInformation', component: () => import('../views/public/PersonalInformation.vue')},
      {path: '/change password', name: 'ChangePassword', component: () => import('../views/public/ChangePassword.vue')},
    ]
  },
]
const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (location) {
  return originalPush.call(this, location).catch(err => err)
}

export default router
